using Gtk;
using System;

namespace TVListings
{
	public class AppletWindow : Gtk.Window
	{
		protected TVListings.ProgramDisplay ProgDisplay;

		public AppletWindow() : base("")
		{
			Stetic.Gui.Build(this, typeof(TVListings.AppletWindow));
			/// TODO: Handle this setup better
			this.WidthRequest = 400;
			this.HeightRequest = 450;
			this.KeepAbove = true;

			/// TODO: Do coloring nicely
			ProgramDisplay.ColorMapping c;
			System.Collections.ArrayList cols = new System.Collections.ArrayList();
			c = (ProgramDisplay.ColorMapping)cols[cols.Add(new ProgramDisplay.ColorMapping())];
			c.Category = "Channel"; c.Color = new Gdk.Color(0xcc, 0xcc, 0xcc);
			c = (ProgramDisplay.ColorMapping)cols[cols.Add(new ProgramDisplay.ColorMapping())];
			c.Category = "Time"; c.Color = new Gdk.Color(0xcc, 0xcc, 0xcc);
			c = (ProgramDisplay.ColorMapping)cols[cols.Add(new ProgramDisplay.ColorMapping())];
			c.Category = "Movie"; c.Color = new Gdk.Color(0xbe, 0xbe, 0xff);
			c = (ProgramDisplay.ColorMapping)cols[cols.Add(new ProgramDisplay.ColorMapping())];
			c.Category = "Sports event"; c.Color = new Gdk.Color(0xbe, 0xff, 0xbe);
			c = (ProgramDisplay.ColorMapping)cols[cols.Add(new ProgramDisplay.ColorMapping())];
			c.Category = "News"; c.Color = new Gdk.Color(0xff, 0xff, 0xbe);
			//c = (ProgramDisplay.ColorMapping)cols[cols.Add(new ProgramDisplay.ColorMapping())];
			//c.Category = "Paid Programming"; c.Color = new Gdk.Color(0xdd, 0xdd, 0xdd);
			c = (ProgramDisplay.ColorMapping)cols[cols.Add(new ProgramDisplay.ColorMapping())];
			c.Category = "Children"; c.Color = new Gdk.Color(0xff, 0xbe, 0xbe);

			ProgDisplay.Colorings = (ProgramDisplay.ColorMapping[])cols.ToArray(typeof(ProgramDisplay.ColorMapping));
		}
		
		public TVGuide Guide
		{
			set { ProgDisplay.Guide = value; }
			get { return ProgDisplay.Guide; }
		}
	}
}
